package com.gopay.common.id;

import java.io.Serializable;

/**
 * 服务Id
 */
public class WorkerId implements Serializable{

    /**
     * 服务
     */
    private String service;

    /**
     * 服务编号
     */
    private String serviceId;

    /**
     * 占用 低位 10 bit
     */
    private Long workerId ;

    public WorkerId(String service, String serviceId) {
        this.service = service;
        this.serviceId = serviceId;
        workerId = Services.toLong(service) << 5 | Long.valueOf(serviceId);
    }

    public String getService() {
        return service;
    }

    public void setService(String service) {
        this.service = service;
    }

    public String getServiceId() {
        return serviceId;
    }

    public void setServiceId(String serviceId) {
        this.serviceId = serviceId;
    }

    public Long getWorkerId() {
        return workerId;
    }

    public void setWorkerId(Long workerId) {
        this.workerId = workerId;
    }

    @Override
    public String toString() {
        return "WorkerId{" +
                "service='" + service + '\'' +
                ", serviceId='" + serviceId + '\'' +
                ", workerId=" + workerId +
                '}';
    }
}
